package com.yuexiang.melodyhub.gateway.config;

import com.yuexiang.melodyhub.gateway.filter.security.AuthProcessor;
import com.yuexiang.melodyhub.gateway.filter.security.CheckAnonymousPathProcessor;
import com.yuexiang.melodyhub.gateway.filter.security.FinalProcessor;
import com.yuexiang.melodyhub.gateway.filter.security.TokenValidationProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AuthConfig {

    @Bean("authProcessorChain")
    public AuthProcessor authProcessorChain(CheckAnonymousPathProcessor checkProcessor,
                                            TokenValidationProcessor tokenProcessor,
                                            FinalProcessor finalProcessor) {
        checkProcessor.setNext(tokenProcessor);
        tokenProcessor.setNext(finalProcessor);
        return checkProcessor;
    }

}
